/**
 * 组织架构api
 */

import request from '@/utils/request'
import {
    unionApiUrl
} from '@/api/config.js'

const api = unionApiUrl+"/unionOrganization"
const vipApi = unionApiUrl+"/unionEmployee"

// 条件查询工会组织信息
export function getUnionOrganizationList(data) {
    return request.post(`${api}/queryUnionOrganizationListParent`, data)
}

// 条件查询工会组织信息
export function getUnionTreeList() {
    return request.post(`${api}/queryTreeList`)
}
// 查询所有工会组织信息
export function queryTreeListByNoAuth() {
    return request.post(`${api}/queryTreeListByNoAuth`)
}

// 工会组织列表
export function getPageUnionOrganization(data) {
    return request.post(`${api}/getPageUnionOrganization`, data)
}

// 删除工会组织列表
export function removePageUnionOrganization(data) {
    return request.post(`${api}/deleteByPrimaryKey`, data)
}

// 撤销工会组织列表
export function undoPageUnionOrganization(data) {
    return request.post(`${api}/revokeByPrimaryKey`, data)
}

// 详情
export function getOrganization(id) {
    return request.get(`${api}/getUnionOrganizationById/${id}`)
}

// 新增
export function addOrganization(data) {
    return request.post(`${api}/insertSelective`, data, { unNotify : true })
}

// 编辑
export function updateOrganization(data) {
    return request.post(`${api}/updateByPrimaryKeySelective`, data,  { unNotify : true })
}

/**
 * 会员管理api
 */

// 工会人员列表
export function getPageUnionEmployeeList(data) {
    return request.post(`${vipApi}/getPageUnionEmployee`, data)
}

// 工会人员详情
export function getUnionEmployeeById(id) {
    return request.get(`${vipApi}/getUnionEmployeeById/${id}`)
}

// 编辑人员详情
export function updateByPrimaryKeySelective(data) {
    return request.post(`${vipApi}/updateByPrimaryKeySelective`,data)
}
// 删除人员
export function deleteByPrimaryKey(data) {
    return request.post(`${vipApi}/deleteByPrimaryKey`,data)
}

// 工会人员列表
export function getUserDeptByOrgId(data) {
    return request.post(`${unionApiUrl}/unionEmployee/getUserDeptByOrgId`, data)
}
